set nocompatible            " 关闭 vi 兼容模式
let mapleader = ","
syntax on                   " 自动语法高亮
syntax enable
set number                  "示行号
set ruler                   " 打开状态栏标尺
set softtabstop=2           " 使得按退格键时可以一次删掉 2 个空格
set shortmess=atI           " 去掉欢迎界面
set autochdir               " 自动切换当前目录为当前文件所在的目录
filetype plugin indent on   " 开启插件
set backupcopy=yes          " 设置备份时的行为为覆盖
set nowrapscan              " 禁止在搜索到文件两端时重新搜索
set incsearch               " 输入搜索内容时就显示搜索结果
set hlsearch                " 搜索时高亮显示被找到的文本
set noerrorbells            " 关闭错误信息响铃
set novisualbell            " 关闭使用可视响铃代替呼叫
set showmatch               " 插入括号时，短暂地跳转到匹配的对应括号
set matchtime=1            " 短暂跳转到匹配括号的时间
set magic                   " 设置魔术
set hidden                  " 允许在有未保存的修改时切换缓冲区，此时的修改由 vim 负责保存
set guioptions-=T           " 隐藏工具栏
set guioptions-=m           " 隐藏菜单栏
set backspace=indent,eol,start
                            " 不设定在插入状态无法用退格键和 Delete 键删除回车符
set cmdheight=1             " 设定命令行的行数为 1
set laststatus=2            " 显示状态栏 (默认值为 1, 无法显示状态栏)
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
"设置缩进
set tabstop=4               " 设置tab键的宽度
set shiftwidth=4            " 换行时,行间交错使用2个空格
set autoindent             " 自动对齐
set backspace=2              " 设置退格键可用
set cindent shiftwidth=4     " 自动缩进2空格
set smartindent              " 智能自动缩进
set ai                      " 设置自动缩进
set nu                    " 显示行号


" 显示Tab符
""set listchars=tab:\|\ ,trail:.,extends:>,precedes:<
""set list
" 在行和段开始处使用制表符
""set smarttab
" 自动格式化
set formatoptions=tcrqn
set foldenable              " 开始折叠
set foldmethod=syntax       " 设置语法折叠
set foldmethod=indent "set default foldmethod
set foldcolumn=0            " 设置折叠区域的宽度
setlocal foldlevel=30       " 设置折叠层数为

" ======= 引号 && 括号自动匹配 start  ======= "
 :inoremap ( ()<ESC>i
 :inoremap ) <c-r>=ClosePair(')')<CR>
 :inoremap { {}<ESC>i
 :inoremap } <c-r>=ClosePair('}')<CR>
 :inoremap [ []<ESC>i
 :inoremap ] <c-r>=ClosePair(']')<CR>
 ":inoremap < <><ESC>i
 ":inoremap > <c-r>=ClosePair('>')<CR>
 :inoremap " ""<ESC>i
 :inoremap ' ''<ESC>i
 "":inoremap ? ??<ESC>i
 function ClosePair(char)
     if getline('.')[col('.')-1] == a:char
         return "\<Right>"
     else
         return a:char
     endif
 endf
 " ======= 引号 && 括号自动匹配 end  ======= "

"nerd_tree 配置 start
let NERDTreeWinPos='right'
nmap <leader>n :NERDTreeToggle<cr>
""窗口启动最大化
if has("win32")
au GUIEnter * simalt ~x
else
function Maximize_Window()
  silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
endfunction
au GUIEnter * call Maximize_Window()
endif
"nerd_tree 配置 end

"emmet 配置起始"
""let g:user_emmet_leader_key='<leader>'
"emmet  配置结束"

" vimim 中文输入法配置 start
let g:Vimim_cloud='baidu'
""let g:Vimim_punctuation = 3
" vimim 中文输入法配置 end
"

" vundle setting >>>
filetype off                  " required
" 启用vundle来管理vim插件
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" 安装插件写在这之后

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Bundle 'EasyHtml.vim'
Bundle 'vim-javascript'
Bundle 'jsbeautify'

" 安装插件写在这之前
call vundle#end()            " required
filetype plugin on    " required

" 常用命令
" :PluginList       - 查看已经安装的插件
" :PluginInstall    - 安装插件
" :PluginUpdate     - 更新插件
" :PluginSearch     - 搜索插件，例如 :PluginSearch xml就能搜到xml相关的插件
" :PluginClean      - 删除插件，把安装插件对应行删除，然后执行这个命令即可

" h: vundle         - 获取帮助

" vundle的配置到此结束 

call plug#begin('~/.vim/plugged') 
Plug 'git://github.com/scrooloose/nerdtree.git'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'easymotion/vim-easymotion'
Plug  'thisivan/vim-matchit'
"emmet-vim old name zencoding
Plug 'mattn/emmet-vim'
"surround 删除括号内的东西
Plug 'tpope/vim-surround'
" ag 文本内容搜索
Plug 'vim-scripts/ag.vim'
" 代码注释
Plug 'scrooloose/nerdcommenter'
" 文件名搜索
Plug 'kien/ctrlp.vim'
Plug 'luochen1990/rainbow'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'posva/vim-vue'
Plug 'ervandew/supertab'
Plug 'Yggdroot/indentLine'
Plug 'honza/vim-snippets' 
"snipmate 依赖 start
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
"snipmate 依赖 end
Plug 'garbas/vim-snipmate'
Plug 'vitalk/vim-lesscss'
call plug#end()


""let g:indentLine_char='┆'
"let g:indentLine_enabled = 1

let g:indent_guides_enable_on_vim_startup = 1

let g:SuperTabDefaultCompletionType="context"

" make YCM compatible with UltiSnips (using supertab)
""let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
""let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
""let g:SuperTabDefaultCompletionType = '<C-n>'

" airline ========= start"
""let g:airline#extensions#tabline#enabled=1 "顶部tab显示"
"nmap <tab> :bn<cr> "设置tab键映射"
set langmenu=zh_CN.UTF-8
set ambiwidth=double "防止特殊符号无法正常显示
language messages zh_CN.utf-8 
" 设置中文帮助
set helplang=cn
" 设置为双字宽显示，否则无法完整显示如:☆
set ambiwidth=double
" 总是显示状态栏 
let laststatus = 2
let g:airline_powerline_fonts = 1   " 使用powerline打过补丁的字体
let g:airline_theme="dark"      " 设置主题
" 开启tabline
let g:airline#extensions#tabline#enabled = 1      "tabline中当前buffer两端的分隔字符
let g:airline#extensions#tabline#left_sep = ' '   "tabline中未激活buffer两端的分隔字符
let g:airline#extensions#tabline#left_alt_sep = '|'      "tabline中buffer显示编号
let g:airline#extensions#tabline#buffer_nr_show = 1
" 映射切换buffer的键位
nnoremap [b :bp<CR>
nnoremap ]b :bn<CR>
" 设置字体 
set guifont=Powerline_Consolas:h14:cANSI
" airline ========= end"

